$(function(){
	//新增
	$('.btn-add').click(function(){
		location.href = rootPath + '/manage/downloadTemplate/add';
	});
	
	//删除
	$('.btn-delete').click(function(){
		var id = $(this).parents('tr').attr('data-id');
		if(id){
			layer.confirm(COMMON_CONSTANT.app_common_title_delete_message, function(index) {
				$.ajax({
    				type: 'POST',
    				url: rootPath + '/manage/downloadTemplate/delete/exec',
    				data: {'id': id},
    				success: function(result){
    					if(result){
    						var r = $.parseJSON(result);
    						if(r && r.resultCode == '000000'){
    							layer.msg('操作成功！');
    							setTimeout(function () {
    								location.href = rootPath + '/manage/downloadTemplate';
    						    }, 1000);
    						}
    					}else{
    						layer.alert('操作失败！',{icon: 5});
    					}
    				}
    			});
			});
		}
	});
});